<?php

namespace App\Models;

class Product extends Model
{
    protected $fillable = ['company_id', 'name', 'thumbnail', 'rating', 'review_count', 'description', 'price', 'delflag'];

    public function company()
    {
        return $this->belongsTo(Company::class, 'company_id');
    }

    public function types()
    {
        return $this->belongsToMany(Type::class, 'product_types', 'type_id', 'product_id');
    }

    public function prizes()
    {
        return $this->hasMany(Prize::class, 'product_id');
    }

}
